package net.csdn.business.common.oauth2.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import net.csdn.business.common.oauth2.model.entity.OauthRefreshToken;
import net.csdn.business.common.domain.request.oauth.OauthRefreshTokenQuery;
import net.csdn.business.common.domain.vo.oauth.OauthRefreshTokenVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * refreshToken信息Mapper接口
 * 
 * @author zhangyl
 * @date 2022-11-08
 */
@Repository
public interface OauthRefreshTokenMapper extends BaseMapper<OauthRefreshToken>
{

    /**
     * 分页查询refreshToken信息列表
     *
     * @param query 字典类型信息
     * @return 字典类型集合信息
     */
    @Select("<script> select id, object_id, token_id, token,authentication,  created_by, created_date, last_modified_by, last_modified_date" +
            "from oauth_refresh_token where 1=1" +
            "<if test='query.tokenId != null  and query.tokenId != \"\"' >" +
            "AND and token_id = #{query.tokenId}" +
            "</if>" +
            "<if test='query.createdBy != null  and query.createdBy != \"\"' >" +
            "AND and created_by = #{query.createdBy}" +
            "</if>" +
            "</script>")
    public List<OauthRefreshTokenVO> findPageList(Page page, @Param("query") OauthRefreshTokenQuery query);


    /**
     * 查询refreshToken信息列表
     * 
     * @param query refreshToken信息
     * @return refreshToken信息集合
     */
    @Select("<script> select id, object_id, token_id, token,authentication,  created_by, created_date, last_modified_by, last_modified_date" +
            "from oauth_refresh_token where 1=1" +
            "<if test='query.tokenId != null  and query.tokenId != \"\"' >" +
            "AND and token_id = #{query.tokenId}" +
            "</if>" +
            "<if test='query.createdBy != null  and query.createdBy != \"\"' >" +
            "AND and created_by = #{query.createdBy}" +
            "</if>" +
            "</script>")
    public List<OauthRefreshTokenVO> selectOauthRefreshTokenList(@Param("query") OauthRefreshTokenQuery query);

}
